<template>
  <view>
    <view class="uni-container" v-if="success">
      <!-- <uni-section :title="'课程名称：' +queryObj.cid+'.'+ queryObj.cname" type="line">
        <uni-section :title="'课程期望达成分数：'+PjList.title.standard+'分（满分100分）'" mode="card"></uni-section>
        <uni-card v-for="(item, index) in PjList.datas" :key="index" padding="0" spacing="0" :is-shadow="true"
          shadow="0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
          <uni-list>
            <uni-list-item :title="'标题：'+item.evaluate_title" :note="'权重：'+item.evaluate_percent+'%'"
              :rightText="'期望分数：'+item.evaluate_standard+'分'"></uni-list-item>
            <uni-list-item :title="item.evaluate_memo"></uni-list-item>
          </uni-list>
        </uni-card>
      </uni-section> -->
      <uni-section :title="'课程名称：' +queryObj.cid+'.'+ queryObj.cname" type="line">
        <uni-card v-for="(item, index) in PjList.datas" :key="index" padding="0" spacing="0" :is-shadow="true"
          shadow="0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
          <uni-list>
            <uni-list-item :title="'标题：'+item.evaluate_title" :note="'权重：'+item.evaluate_percent+'%'"
              :rightText="'期望分数：'+item.evaluate_standard+'分'"></uni-list-item>
            <uni-list-item :title="item.evaluate_memo"></uni-list-item>
          </uni-list>
        </uni-card>
        <uni-section title="">
          <template v-slot:right >
            课程期望达成分数：{{standard}}分（满分100分）
          </template>
        </uni-section>
      </uni-section>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        // 上个网页传的数据，课程名称id
        queryObj: {
          cid: '',
          cname: ''
        },
		success : false,
		standard : "",
        PjList: []
      };
    },
    onLoad(options) {
      // 将页面参数转存到 this.queryObj 对象中
      // console.log(options)
      this.queryObj.cid = options.subject || ''
      this.queryObj.cname = options.curriulum_name || ''
      this.getPj1211Results()
    },
    methods: {
      async getPj1211Results() {
        const {
          data: res
        } = await uni.$http.get('?command=pj1211&subject=' + this.queryObj.cid)

		this.success = res.success
		if(res.success) {
			this.PjList = res.data
			this.standard = res.data.title.standard
		} else {
			uni.showToast({
				icon: 'error',
				title: '失败'
			});
		}
		
      }
    }
  }
</script>

<style lang="scss">
  .title {
    background-color: #f5f5f5;
  }

  .uni-table :first-child {
    background-color: #EEF6FF;
  }

  .uni-table {
    .uni-table-th {
      vertical-align: middle;
      text-align: center;
    }

    .uni-table-td {
      vertical-align: middle;
      text-align: center;
    }
  }
</style>
